The Built in function in a lists means that functions are already defined or predefined functions that helps to perform the various operations in the python list . the built in functions provide the rich set of function that perform a more operations in the python code . some most common built in function in the below
Len() function in the list is used to checks the length of the list elements . Example in the below
list1=[10,20,30,"hello","coder"]
print(len(list1))
5
The sum() function is used to perform the addition operations . and find the sum of the all the elements in the list . and the sum() function performs only can list having a number data type . Example in the below
list1=[10,20,30 ]
print(sum(list1))
60
The min() function performs a some operation if the list can having only number data type . it is used to find the minimum value of element in the list. Example in the below
list1=[10,20,30. ]
print(min(list1))
10
The max() function in the list can performs the operation when the list can having the number data type only. it is used to find the maximum value of element in the list. Example in the below
list1=[10,20,30. ]
print(max(list1))
30.0
The any() function is returns the true when the list can having at least one element. the list is null or none then returns the false. example in the below
list1=[10,20,30]
print(any(list1))
True
The all Function is performs a operation in the list . it returns the true when the list can having the more then one data element or multiple data types . the list having the a single data element then returns a false. / if the list can having the none type then also it returns false Example in the below
list1=[10,20,30,None]
print(all(list1))
False
The sorted() function is used to sort the list element in a ascending or descending order . if the list having number type then the sorted() function is sort the list element base on the value . if the list can having a string type then it sort the based on alphabetical order . Example in the below
list1=[30,10,3,5,6,]#number type
print(sorted(list1))
[3, 5, 6, 10, 30]
list1=["a", "d","c", "e", "z"]#string, type print(sorted(list1))
['a', 'c', 'd', 'e', 'z']
The list() function is used to convert the one data type to another data type . Example in the below
list1=("a", "d","c", "e", "z")#tuple, type
print(list(list1))
print(type(list1))
['a', 'd', 'c', 'e', 'z']
class 'list'